
@echo off

@rem	DOWNLOAD SOFTPAY APPLICATION

set SPDBG=
set SPHOST=
set SPSPAN=
set SPMM=
set SPVMAC=
set SPVTMA=
set SPHW=
set     SPPORT=1
set SP2K=SP2000R.DLD
set SPDLD=SOFTPAYX.DLD
set SPPARMS=0

@rem Do the Multi Merchant copy unconditionally to make MM1 default
REM copy mitmm1.dat mit.dat
if exist axsdmm1.dat copy axsdmm1.dat axsd.dat
if exist axppmm1.dat copy axppmm1.dat axpp.dat
if exist vitlmm1.dat copy vitlmm1.dat vitl.dat
if exist bmmhmm1.dat copy bmmhmm1.dat bmmh.dat
if exist fdmsmm1.dat copy fdmsmm1.dat fdms.dat
if exist novamm1.dat copy novamm1.dat nova.dat
if exist cdntmm1.dat copy cdntmm1.dat cdnt.dat
if exist paymmm1.dat copy paymmm1.dat paym.dat
if exist npcmm1.dat copy npcmm1.dat npc.dat
if exist telemm1.dat copy telemm1.dat tele.dat
if exist telbmm1.dat copy telbmm1.dat telb.dat
if exist efxamm1.dat copy efxamm1.dat efxa.dat
if exist efxbmm1.dat copy efxbmm1.dat efxb.dat
if exist xchkmm1.dat copy xchkmm1.dat xchk.dat
if exist caremm1.dat copy caremm1.dat care.dat


:GetParms
if %SPPARMS%==9	goto	:TooMany
if %SPPARMS%==8	goto	:TooMany
if %SPPARMS%==7 goto    :7Parm
if %SPPARMS%==6	goto	:7Parm
if %SPPARMS%==5	goto	:6Parm
if %SPPARMS%==4	goto	:5Parm
if %SPPARMS%==3	goto	:4Parm
if %SPPARMS%==2	goto	:3Parm
if %SPPARMS%==1	goto	:2Parm
if %SPPARMS%==0	goto	:1Parm

:1Parm
set SPPARMS=1
if %1.==?.		goto :Usage
if %1.==h.		goto :Usage
if %1.==H		goto :Usage
if %1.==f.		goto :Flash
if %1.==F.		goto :Flash
if %1.==d.		goto :Debug
if %1.==D.		goto :Debug
if %1.==s.		goto :Spanish
if %1.==S.		goto :Spanish
if %1.==mm3.	goto :MM3
if %1.==MM3.	goto :MM3
if %1.==mm15.	goto :MM15
if %1.==MM15.	goto :MM15
if %1.==mm1.	goto :MM1
if %1.==MM1.	goto :MM1
if %1.==2.		goto :ComParm2
if %1.==v.		goto :VMAC
if %1.==V.		goto :VMAC
if %1.==t.		goto :VTMA
if %1.==T.		goto :VTMA
if %1.==ADS.            goto :ADS
if %1.==. 		goto :NoParm
goto Usage

:2Parm
set SPPARMS=2
if %2.==?.		goto :Usage
if %2.==h.		goto :Usage
if %2.==H		goto :Usage
if %2.==f.		goto :Flash
if %2.==F.		goto :Flash
if %2.==d.		goto :Debug
if %2.==D.		goto :Debug
if %2.==s.		goto :Spanish
if %2.==S.		goto :Spanish
if %2.==mm3.	goto :MM3
if %2.==MM3.	goto :MM3
if %2.==mm15.	goto :MM15
if %2.==MM15.	goto :MM15
if %2.==mm1.	goto :MM1
if %2.==MM1.	goto :MM1
if %2.==2.		goto :ComParm2
if %2.==v.		goto :VMAC
if %2.==V.		goto :VMAC
if %2.==t.		goto :VTMA
if %2.==T.		goto :VTMA
if %2.==ADS.            goto :ADS
if %2.==. 		goto :NoParm
goto Usage

:3Parm
set SPPARMS=3
if %3.==?.		goto :Usage
if %3.==h.		goto :Usage
if %3.==H		goto :Usage
if %3.==f.		goto :Flash
if %3.==F.		goto :Flash
if %3.==d.		goto :Debug
if %3.==D.		goto :Debug
if %3.==s.		goto :Spanish
if %3.==S.		goto :Spanish
if %3.==mm3.	goto :MM3
if %3.==MM3.	goto :MM3
if %3.==mm15.	goto :MM15
if %3.==MM15.	goto :MM15
if %3.==mm1.	goto :MM1
if %3.==MM1.	goto :MM1
if %3.==2.		goto :ComParm2
if %3.==v.		goto :VMAC
if %3.==V.		goto :VMAC
if %3.==t.		goto :VTMA
if %3.==T.		goto :VTMA
if %3.==ADS.            goto :ADS
if %3.==. 		goto :NoParm
goto Usage

:4Parm
set SPPARMS=4
if %4.==?.		goto :Usage
if %4.==h.		goto :Usage
if %4.==H		goto :Usage
if %4.==f.		goto :Flash
if %4.==F.		goto :Flash
if %4.==d.		goto :Debug
if %4.==D.		goto :Debug
if %4.==s.		goto :Spanish
if %4.==S.		goto :Spanish
if %4.==mm3.	goto :MM3
if %4.==MM3.	goto :MM3
if %4.==mm15.	goto :MM15
if %4.==MM15.	goto :MM15
if %4.==mm1.	goto :MM1
if %4.==MM1.	goto :MM1
if %4.==2.		goto :ComParm2
if %4.==v.		goto :VMAC
if %4.==V.		goto :VMAC
if %4.==t.		goto :VTMA
if %4.==T.		goto :VTMA
if %4.==. 		goto :NoParm
if %4.==ADS.            goto :ADS
goto Usage

:5Parm
set SPPARMS=5
if %5.==?.		goto :Usage
if %5.==h.		goto :Usage
if %5.==H		goto :Usage
if %5.==f.		goto :Flash
if %5.==F.		goto :Flash
if %5.==d.		goto :Debug
if %5.==D.		goto :Debug
if %5.==s.		goto :Spanish
if %5.==S.		goto :Spanish
if %5.==mm3.	goto :MM3
if %5.==MM3.	goto :MM3
if %5.==mm15.	goto :MM15
if %5.==MM15.	goto :MM15
if %5.==mm1.	goto :MM1
if %5.==MM1.	goto :MM1
if %5.==2.		goto :ComParm2
if %5.==v.		goto :VMAC
if %5.==V.		goto :VMAC
if %5.==t.		goto :VTMA
if %5.==T.		goto :VTMA
if %5.==ADS.            goto :ADS
if %5.==. 		goto :NoParm
goto Usage

:6Parm
set SPPARMS=6
if %6.==?.		goto :Usage
if %6.==h.		goto :Usage
if %6.==H		goto :Usage
if %6.==f.		goto :Flash
if %6.==F.		goto :Flash
if %6.==d.		goto :Debug
if %6.==D.		goto :Debug
if %6.==s.		goto :Spanish
if %6.==S.		goto :Spanish
if %6.==mm3.	goto :MM3
if %6.==MM3.	goto :MM3
if %6.==mm15.	goto :MM15
if %6.==MM15.	goto :MM15
if %6.==mm1.	goto :MM1
if %6.==MM1.	goto :MM1
if %6.==2.		goto :ComParm2
if %6.==v.		goto :VMAC
if %6.==V.		goto :VMAC
if %6.==t.		goto :VTMA
if %6.==T.		goto :VTMA
if %6.==ADS.            goto :ADS
if %6.==. 		goto :NoParm
goto Usage

:7Parm
set SPPARMS=7
if %7.==?.              goto :Usage
if %7.==h.              goto :Usage
if %7.==H               goto :Usage
if %7.==f.              goto :Flash
if %7.==F.              goto :Flash
if %7.==d.              goto :Debug
if %7.==D.              goto :Debug
if %7.==s.              goto :Spanish
if %7.==S.              goto :Spanish
if %7.==mm3.    goto :MM3
if %7.==MM3.    goto :MM3
if %7.==mm15.   goto :MM15
if %7.==MM15.   goto :MM15
if %7.==mm1.    goto :MM1
if %7.==MM1.    goto :MM1
if %7.==2.              goto :ComParm2
if %7.==v.              goto :VMAC
if %7.==V.              goto :VMAC
if %7.==t.              goto :VTMA
if %7.==T.              goto :VTMA
if %7.==ADS.            goto :ADS
if %7.==.               goto :NoParm
goto Usage


:8Parm
if %8.==.               goto :NoParm
goto TooMany

:MM1
set SPMM=
goto :GetParms

:MM3
set SPMM=SPMM3.DLD
copy mitmm3.dat mit.dat
if exist axsdmm3.dat copy axsdmm3.dat axsd.dat
if exist axppmm3.dat copy axppmm3.dat axpp.dat
if exist vitlmm3.dat copy vitlmm3.dat vitl.dat
if exist bmmhmm3.dat copy bmmhmm3.dat bmmh.dat
if exist fdmsmm3.dat copy fdmsmm3.dat fdms.dat
if exist novamm3.dat copy novamm3.dat nova.dat
if exist cdntmm3.dat copy cdntmm3.dat cdnt.dat
if exist paymmm3.dat copy paymmm3.dat paym.dat
if exist npcmm3.dat copy npcmm3.dat npc.dat
if exist telemm3.dat copy telemm3.dat tele.dat
if exist telbmm3.dat copy telbmm3.dat telb.dat
if exist efxamm3.dat copy efxamm3.dat efxa.dat
if exist efxbmm3.dat copy efxbmm3.dat efxb.dat
if exist xchkmm3.dat copy xchkmm3.dat xchk.dat
if exist caremm3.dat copy caremm3.dat care.dat

goto :GetParms

:ADS
set SPHW=ADS
goto :GetParms


:MM15
set SPMM=SPMM15.DLD
copy mitmm15.dat mit.dat
if exist axsdmm15.dat copy axsdmm15.dat axsd.dat
if exist axppmm15.dat copy axppmm15.dat axpp.dat
if exist vitlmm15.dat copy vitlmm15.dat vitl.dat
if exist bmmhmm15.dat copy bmmhmm15.dat bmmh.dat
if exist fdmsmm15.dat copy fdmsmm15.dat fdms.dat
if exist novamm15.dat copy novamm15.dat nova.dat
if exist cdntmm15.dat copy cdntmm15.dat cdnt.dat
if exist paymmm15.dat copy paymmm15.dat paym.dat
if exist npcmm15.dat copy npcmm15.dat npc.dat
if exist telemm15.dat copy telemm15.dat tele.dat
if exist telbmm15.dat copy telbmm15.dat telb.dat
if exist efxamm15.dat copy efxamm15.dat efxa.dat
if exist efxbmm15.dat copy efxbmm15.dat efxb.dat
if exist xchkmm15.dat copy xchkmm15.dat xchk.dat
if exist caremm15.dat copy caremm15.dat care.dat

goto :GetParms

:Spanish
SET SPSPAN=SPSPAN.DLD
goto :GetParms

:Debug
SET SPDBG=SPDBG.DLD
goto :GetParms

:Flash
SET SP2K=SP2000F.DLD
goto :GetParms

:ComParm2
SET SPPORT=2
goto :GetParms

:VMAC
SET SPVMAC=1
SET SP2K=SP2000F.DLD
goto :GetParms

:VTMA
SET SPVTMA=1
goto :VMAC

:Usage
cls
@echo.
@echo    DSOFTPAY.BAT    Download targets for Verix Softpay Terminal application.
@echo.	
@echo        Defaults: COM1, Engl Language files, RAM for SP2000.OUT, 1 Merchant.
@echo.
@echo        Command Line Options:
@echo.
@echo            ?,h,H       - Display this screen
@echo            f,F         - Download executable to FLASH
@echo            d,D         - Download DBMON.OUT for debugging
@echo            s,S         - Download SPANISH language files
@echo            mm3,MM3     - Download 3 Merchant data files
@echo            mm15,MM15   - Download 15 Merchant data files
@echo            mm1,MM1     - Download 1 Merchant data files
@echo            2           - Download via COM2
@echo            v,V         - Download with VMAC Configuration DLD (SOFTPAY in GID11)
@echo            t,T         - Download with VTMA Configuration DLD 
@echo.
goto :End

:TooMany
@echo.
@echo.
@echo   ERROR:		TOO MANY PARAMETERS
@echo.
@echo.
goto :End

:NoParm

REM del     %SPDLD%

if %SPVMAC%.==1. goto :SPGID11
@echo -i..\..\download\setgroup.1 > spgidx.dld
goto :GID_DONE
:SPGID11
@echo -i..\..\download\setgroup.2 > spgidx.dld
:GID_DONE
type spgidx.dld >> %SPDLD%

@REM	Add RAM/FLASH .OUT File and Signature file
type %SP2K% >> %SPDLD%

@REM	Add FLASH Files to DLD
type SPFLASH.DLD >> %SPDLD%

@REM	Add RAM Files to DLD
type SPRAM.DLD >> %SPDLD%

if %SPDBG%.==.		goto :SkipDbg
type SPDBG.DLD >> %SPDLD%
:SkipDbg

@REM	Add English Files to DLD
type SPENGL.DLD >> %SPDLD%

if %SPSPAN%.==.		goto :SkipSpan
type SPSPAN.DLD >> %SPDLD%
:SkipSpan

if %SPMM%.==.		goto :SkipMM
type %SPMM% >> %SPDLD%
:SkipMM

@REM	Add Config.sys data to DLD
type SPCONFIG.DLD >> %SPDLD%

@REM	Add Host Files to DLD
type SPHOST.DLD >> %SPDLD%

@REM	Add Shared Lib File and Signature file to DLD
type SPSHARED.DLD >> %SPDLD%

if %SPVMAC%.==. goto :DLD_DONE
type VMAC.DLD >> %SPDLD%

if %SPVTMA%.==. goto :DLD_DONE
type VTMA.DLD >> %SPDLD%

:DLD_DONE

if %SPHW%.==ADS. move %SPDLD% ..\ADS\files
if %SPHW%.==. move %SPDLD% ..\SDS\files
if %SPHW%.==.  SET SPHW=SDS
@echo ON

cd ..\%SPHW%\files

ddl -p%SPPORT%  -c  -b115200  -f%SPDLD%
@echo OFF
cd ..\..\download
:End
set SPPORT=
set SP2K=
set SPDLD=
set SPDBG=
set SPHOST=
set SPPARMS=
set SPSPAN=
set SPMM=
set SPVMAC=
set SPVTMA=
SET SPHW=

